package com.life.ai.server.modules.develop.enums;

import com.life.ai.server.common.exception.ClientException;
import lombok.Getter;

/**
 * SysJobStatusEnum
 *
 * @author kylewka
 * @since 2025/1/6
 */
@Getter
public enum SysJobStatusEnum {

    /**
     * 运行
     */
    RUNNING(0, "运行"),

    /**
     * 停止
     */
    STOPPED(1, "停止");

    private final Integer code;
    private final String  desc;

    SysJobStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static void validate(Integer code) {
        boolean flag = RUNNING.getCode().equals(code) || STOPPED.getCode().equals(code);
        if (!flag) {
            throw new ClientException("不支持的定时任务状态：{}", code);
        }
    }
}
